package com.example.rydwlib.adapter

import android.widget.ImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.example.baselib.utils.TimeUtils
import com.example.rydwlib.R
import com.example.rydwlib.bean.RyPersonData

/**
 * Author: sxygsj
 * Date: 2020/5/7 15:26
 * Description: 人员人员监测
 * History:
 * <author> <time> <version> <desc>
 * 作者姓名 修改时间 版本号 描述
 */
class RyPersonAdapter(layoutResId: Int): BaseQuickAdapter<RyPersonData,BaseViewHolder>(layoutResId) {
    override fun convert(helper: BaseViewHolder, item: RyPersonData) {
        helper.getView<ImageView>(R.id.ry_person_expand_img).setImageResource(R.mipmap.expand)
        helper.setGone(R.id.ry_department_ly, false)
        helper.addOnClickListener(R.id.ry_person_expand_ly)
        helper.setText(R.id.ry_regionname, item.regionname)
            .setText(R.id.ry_person_name, item.personname + "-" + item.personPost)
            .setText(R.id.ry_person_code, item.cardnumber)
            .setText(R.id.ry_department, item.department)
            .setText(
                R.id.ry_onoutwellstate,
                if (item.onoutwellstate == "1") "入井" else "出井"
            )
            .setText(R.id.ry_onwelltime, TimeUtils.timeFormat(item.onwelltime))
            .setText(R.id.ry_inarea_time, TimeUtils.timeFormat(item.onregiontime))
            .setText(R.id.ry_station_name, item.stationname)
            .setText(R.id.ry_instation_time, TimeUtils.timeFormat(item.onstationtime))
    }
}